﻿/*
 * @Autor: PK
 * @Date: 2022/01/03 10:40:SS
 */

using System.ComponentModel;
using System.Runtime.CompilerServices;
using PropertyChanged;
using ShkSimulation.core.dao.input.resource;
using ShkSimulation.carsharing;
using ShkSimulation.desktop.Annotations;

namespace ShkSimulation.desktop.setting.tools {

	[AddINotifyPropertyChangedInterface]
	public record SimulationConfig: AutoSaveConfig {

		public ResourceType 输入类型 { get; set; }
		public string 站台文件 { get; set; }
		public string 道路文件 { get; set; }
		public string 需求文件 { get; set; }
		public string 导航文件 { get; set; }
		public NavigateType 导航类型 { get; set; }
		public bool 启用导航 { get; set; }
		public bool 启用调度 { get; set; }
		public int 调度触发上阈值 { get; set; }
		public int 调度触发下阈值 { get; set; }
		public string 并行设置 { get; set; }
		
		public bool IsSetValid() {
			return !string.IsNullOrEmpty(站台文件) &&
			       !string.IsNullOrEmpty(道路文件) &&
			       !string.IsNullOrEmpty(需求文件) &&
			       (!启用导航 || (启用导航 && !string.IsNullOrEmpty(导航文件))) &&
			       (!启用调度 || (启用调度 && 调度触发上阈值 > 调度触发下阈值));
		}

		public event PropertyChangedEventHandler PropertyChanged;

		[NotifyPropertyChangedInvocator]
		protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) {
			PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
		}

	}

}